package com.example.demo.mapper;

import com.example.demo.entity.PersonRelationship;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface PersonRelationshipMapper {
    List<PersonRelationship> selectAll();

    @Select("SELECT * FROM `person_relationship` WHERE id = #{id}")
    PersonRelationship selectById(Long id);

    void insert(PersonRelationship relationship);

    void updateById(PersonRelationship relationship);

    @Delete("DELETE FROM `person_relationship` WHERE id = #{id}")
    void deleteById(Long id);

    @Select("SELECT * FROM `person_relationship` WHERE person_id1 = #{personId}")
    List<PersonRelationship> selectByPersonId1(Long personId);

    @Select("SELECT * FROM `person_relationship` WHERE person_id2 = #{personId}")
    List<PersonRelationship> selectByPersonId2(Long personId);
}